<SCRIPT>
	if (window.top.$("#current_pos").data('clicknum') == 1
			|| window.top.$("#current_pos").data('clicknum') == null) {
		parent.document.getElementById('display_center_id').style.display = '';
		parent.document.getElementById('center_frame').src = '/content/manage/categorys/';
		window.top.$("#current_pos").data('clicknum', 0);
	}

	//推送
	function push() {
		var str = 0;
		var id = tag = '';
		$("input[name='ids[]']").each(function() {
			if ($(this).attr('checked') == 'checked') {
				str = 1;
				id += tag + $(this).val();
				tag = ',';
			}
		});
		if (str == 0) {
			window.top.art.dialog({
				icon : 'error',
				content : '您没有勾选信息!'
			});
			return false;
		}

		window.top.art.dialog.open('/Content/push/' + id + '/',{
			id : 'push',
			title : '推送',
			id : 'push',
			width : 800,
			height : 500,
			lock : true
		});
	}

	//批量移动
	function remove() {
		var str = 0;
		var id = tag = '';
		$("input[name='ids[]']").each(function() {
			if ($(this).attr('checked') == 'checked') {
				str = 1;
				id += tag + $(this).val();
				tag = ',';
			}
		});
		if (str == 0) {
			window.top.art.dialog({
				icon : 'error',
				content : '您没有勾选信息!'
			});
			return false;
		}

		window.top.art.dialog.open('/Content/remove/' + id + '/',{
			title : '批量移动',
			id : 'remove',
			width : 800,
			height : 450,
			lock : true
		});
	}

	//删除新闻
	function confirm_delete() {
		window.top.art.dialog({
			content:'确认删除吗？',
			ok:function(){
				myform.submit();
				return true;
			},
			canceVal:'取消',
			cancel:true
		});
	}

	//查看评论
	function view_comment(id, name) {
		window.top.art.dialog.open('/Content/comment/' + id + '/',{
			yesText : '关闭',
			title : '查看评论：' + name,
			id : 'view_comment',
			width : 800,
			height : 500,
			lock : true
		});
	}

	function refersh_window() {
		var refersh_time = $.cookie('refersh_time');
		if (refersh_time == 1) {
			window.location.reload();
		}
	}

	$(document).ready(function() {

		setInterval(closeParent, 5000);
		$.cookie('refersh_time', 0);
		setInterval("refersh_window()", 3000);
		
		$(".preview").preview();

		Calendar.setup({
			weekNumbers : false,
			inputField : "start_time",
			trigger : "start_time",
			dateFormat : "%Y-%m-%d",
			showTime : false,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});

		Calendar.setup({
			weekNumbers : false,
			inputField : "end_time",
			trigger : "end_time",
			dateFormat : "%Y-%m-%d",
			showTime : false,
			minuteStep : 1,
			onSelect : function() {
				this.hide();
			}
		});
	});
	function closeParent() {
		if ($('#closeParentTime').html() == '') {
			window.top.$(".left_menu").addClass("left_menu_on");
			window.top.$("#openClose").addClass("close");
			window.top.$("html").addClass("on");
			$('#closeParentTime').html('1');
			window.top.$("#openClose").data('clicknum', 1);
		}
	}
	//搜索
	function Search() {
		url = '/Content/manage/<?php echo $cid;?>/';
		url += 'posids:' + $('#posids').val() + '/';
		url += 'searchtype:' + $('#searchtype').val() + '/';
		url += 'keyword:' + $('#keyword').val() + '/';
		url += 'start_time:' + $('#start_time').val() + '/';
		url += 'end_time:' + $('#end_time').val() + '/';

		window.location.href = url;
	};
</SCRIPT>
<body>
	<div id="closeParentTime" style="display: none"></div>
	<div class="pad-10">
		<div class="content-menu ib-a blue line-x">
			<a class="add fb" href="javascript:;"
				onclick="javascript:openwinx('/Content/addContent/<?php echo $cid;?>/','添加内容')"><em>添加内容</em></a>
		</div>
		<div id="searchid">
			<form name="searchform" action="/content/manage/search/"
				method="post">
				<input type="hidden" value="<?php echo $cid;?>" name="catid">
				<table width="100%" cellspacing="0" class="search-form">
					<tbody>
						<tr>
							<td>
								<div class="explain-col">
									添加时间： <input type="text" name="start_time" id="start_time"
										value="" size="10" class="date" readonly>&nbsp; -
									&nbsp;<input type="text" name="end_time" id="end_time" value=""
										size="10" class="date" readonly>&nbsp; <select
										name="posids" id="posids"><option value='' selected>全部</option>
										<option value="0">不置顶</option>
										<option value="1">置顶</option>
									</select> <select name="searchtype" id="searchtype">
										<option value='1' selected>标题</option>
										<option value='2'>简介</option>
										<option value='3'>用户名</option>
										<option value='4'>ID</option>
									</select> <input name="keyword" id="keyword" type="text" value=""
										class="input-text" /> <input type="button" name="dosearch"
										class="button" onclick="Search()" value="搜索" />
								</div>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<div id="content_list">
			<form name="myform" id="myform" action="" method="post">
				<input type="hidden" value="<?php echo $cid;?>" name="catid">
				<div class="table-list">
					<table width="100%">
						<thead>
							<tr>
								<th width="16"><input type="checkbox" value=""
									id="check_box" onclick="selectall('ids[]');"></th>
								<th width="40">ID</th>
								<th>标题</th>
								<th width="40">点击量</th>
								<th width="70">发布人</th>
								<th width="118">更新时间</th>
								<th width="72">管理操作</th>
							</tr>
						</thead>
						<tbody>
							<?php
								if(!empty($list)){
						  		foreach ($list as $val) { 
							?>
							<tr>
								<td align="center"><input class="inputcheckbox "
									name="ids[]" value="<?php echo $val['News']['id'] ?>"
									type="checkbox"></td>
								<td align='center'>
									<?php echo $val['News']['id'] ?>
								</td>
								<td><a href="javascript:;"
									onclick="javascript:openwinx('/Content/editContent/<?php echo $cid ?>/<?php echo $val['News']['id'] ?>/','')">
										<span style=""> <?php echo $val['News']['title'] ?>
									</span>
								</a> <?php if($val['News']['news_img']) { ?> <img title="" class="preview" bimg="<?php echo Configure::read('admin_config.mainDomain'); ?><?php echo $val['News']['news_img'] ?>"
									src="/img/icon/small_img.gif"> <?php } ?></td>
								<td align='center'
									title="今日点击：0&#10;昨日点击：&#10;本周点击：0&#10;本月点击：0">
									<?php echo $val['News']['hits'] ?>
								</td>
								<td align='center'>
									<?php echo $val['News']['username'] ?>
								</td>
								<td align='center'>
									<?php echo $val['News']['updatetime'] ?>
								</td>
								<td align='center'><a href="javascript:;"
									onclick="javascript:openwinx('/Content/editContent/<?php echo $cid ?>/<?php echo $val['News']['id'] ?>/','编辑内容')">修改</a>
									| <a
									href="javascript:view_comment('<?php echo $val['News']['id'] ?>','<?php echo $val['News']['title'] ?>')">评论</a>
								</td>
							</tr>
							<?php } } ?>
						</tbody>
					</table>
					<div class="btn">
						<input type="button" class="button" value="删除"
							onclick="myform.action='/Content/delete/<?php echo $cid;?>/';return confirm_delete()" />
						<input type="button" class="button" value="推送" onclick="push();" />
						<input type="button" class="button" value="批量移动"
							onclick="remove();" />
					</div>
					<div id="pages">
						<?php echo $this->Page->show($perpage, $total, $curpage, 10, '/Content/manage/' . $cid . '/posids:' . $posids . '/searchtype:' . $searchtype . '/keyword:' . $keyword . '/start_time:' . $start_time . '/end_time:' . $end_time . '/page:', 2 .'/'); ?>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>